<template>
    <div class="newsdetials-container">
        <h3 class="title">{{newsDetials.title}}</h3>
        <p class="subtitle">
            <span>发表时间：{{newsDetials.first_chapter.ctime | dateFormat}}</span>
            <span>点击：{{newsDetials.hh_hot}}次</span>
        </p>
        <div class="content" v-html="newsDetials.desc">恶法士大夫</div>
        <!--评论模块-->
        <comment></comment>
    </div>
</template>
<script>
 //导入comment组件
 import comment from "../subcomvue/Comment.vue";
export default {
    data(){
        return{
            id:this.$route.params.id,
            newsDetials:[]//用于存放新闻详情内容
        }
    },
    created(){
        this.getNewsDetials()
    },
    methods:{
        getNewsDetials(){
            this.$http.get(`https://www.apiopen.top/novelInfoApi?name=${this.id}`).then(result=>{
                let newsDetials = result.body.data;
               // console.log(newsDetials.aladdin);
                this.newsDetials = newsDetials.aladdin;
            })
        }
    },
    components:{
        comment
    }
}
</script>
<style scoped lang="less">
.newsdetials-container{
    padding: 0 15px;
    h3{
        margin: 0 auto;
        text-align: center;
        padding: 10px 0;
    }
    .subtitle{
        display: flex;
        justify-content: space-between;
        font-size: 12px;
        padding: 0 20px;
        border-bottom: 1px silver solid;
    }
    .content{
        font-size: 14px;
        text-indent: 20px;
        padding-bottom:15px;
        border-bottom: 1px silver solid;
        margin-bottom: 10px;
    }
}
</style>